package com.TestDemo.TempTest;

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: zjz
 * @Date: 2021/11/19/8:59
 * @Description:
 * @Target: 测试Arrays的sort方法
 */
public class ArraysSortMethodTest {

    public static void main(String[] args) {
        Integer[] arr = new Integer[]{1,3,5,7,5,2,3,4,9};
        Arrays.sort(arr, Collections.reverseOrder());

        for (Integer integer : arr) {
            System.out.print(integer+" ");
        }

    }



    public static class MyComparator implements Comparator<Integer>{

        @Override
        public int compare(Integer o1,Integer o2){
            return -(o1-o2);
        }
    }

}
